/*    */ package com.qmsk.business.member.levelService.controller;
/*    */ 
/*    */ import com.qmsk.business.member.levelService.dao.LevelServiceDAO;
/*    */ import com.utils.gson.out.GsonEbRst;
/*    */ import com.utils.jdbc.connection.DbConnection;
/*    */ import com.utils.web.RequestUtils;
/*    */ import com.utils.web.ResponseUtils;
/*    */ import java.sql.SQLException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.transaction.annotation.Transactional;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/levelService"})
/*    */ public class LevelServiceController
/*    */ {
/* 26 */   private static final Logger logger = Logger.getLogger(LevelServiceController.class);
/*    */ 
/*    */   @Autowired
/*    */   private LevelServiceDAO dao;
/*    */ 
/*    */   @RequestMapping(value={"find/levelId/{levelId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListOfCarTypeId(HttpServletRequest request, HttpServletResponse response, @PathVariable("levelId") Integer levelId)
/*    */   {
/*    */     try {
/* 35 */       GsonEbRst gsonEbRst = this.dao.getGsonOfCarTypeId(levelId);
/* 36 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 38 */       logger.error(e);
/* 39 */       ResponseUtils.setErrorMsgResponse(
/* 40 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @Transactional
/*    */   @RequestMapping(value={"insert/List"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   public void insertList(HttpServletRequest request, HttpServletResponse response) {
/* 47 */     String sJson = RequestUtils.getString(request, "data");
/* 48 */     int nUpdates = -1;
/*    */     try {
/* 50 */       this.dao.deleteListPk(sJson);
/* 51 */       nUpdates = this.dao.insertList(sJson);
/*    */     } catch (SQLException e) {
/* 53 */       ResponseUtils.setErrorMsgResponse(
/* 54 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 55 */         e.getMessage(), response);
/* 56 */       logger.error(e);
/*    */     } finally {
/* 58 */       if (nUpdates <= -1)
/* 59 */         DbConnection.rollback();
/*    */       else
/* 61 */         DbConnection.commit();
/*    */     }
/*    */   }
/*    */ 
/*    */   @Transactional
/*    */   @RequestMapping(value={"delete/List"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   public void deleteList(HttpServletRequest request, HttpServletResponse response)
/*    */   {
/* 69 */     int nUpdates = -1;
/* 70 */     String sJson = RequestUtils.getStringOfId(request);
/*    */     try {
/* 72 */       nUpdates = this.dao.deleteList(sJson);
/*    */     } catch (SQLException e) {
/* 74 */       ResponseUtils.setErrorMsgResponse(
/* 75 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 76 */         e.getMessage(), response);
/* 77 */       logger.error(e);
/*    */     } finally {
/* 79 */       if (nUpdates <= -1)
/* 80 */         DbConnection.rollback();
/*    */       else
/* 82 */         DbConnection.commit();
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.levelService.controller.LevelServiceController
 * JD-Core Version:    0.5.3
 */